//
//  RealTimeHBBackController.m
//  CoolTennisBall
//
//  Created by Coollang on 16/8/15.
//  Copyright © 2016年 CoolLang. All rights reserved.
//

#import "RealTimeHBBackController.h"
#import "MTScatterChart.h"
#import "NSDate+FormateString.h"
#import "RealTimeTrainModel.h"
#import "ChartItem.h"


@interface RealTimeHBBackController ()

@property (weak, nonatomic) IBOutlet MTScatterChart *backScatterView;
// 总击球数
@property (weak, nonatomic) IBOutlet UILabel *backTotalHitBallNumberLabel;
@property (weak, nonatomic) IBOutlet UILabel *backStandardNumerLabel;
@property (weak, nonatomic) IBOutlet UILabel *backPassRateLabel;

@property (weak, nonatomic) IBOutlet UILabel *backShangxuanLabel;
@property (weak, nonatomic) IBOutlet UILabel *backPingjiLabel;
@property (weak, nonatomic) IBOutlet UILabel *backXueqiuLabel;

@property (weak, nonatomic) IBOutlet UILabel *backAverageSpeedLabel;

@end

@implementation RealTimeHBBackController

- (void)viewDidLoad {
    [super viewDidLoad];
    // 设置散点图参数
    self.backScatterView.yTitleArray = @[@0, @20, @40, @60, @80, @100, @120, @140];
    
}



- (void)viewDidLayoutSubviews {
    [super viewDidLayoutSubviews];
    
    [self.backScatterView layoutIfNeeded];
    [self.backScatterView setDefaultValues];
    
      [self.backScatterView updateTargetSpeed:self.backTargetSpeed withTextString:@"目标拍速"];
    
    [self.backScatterView drawChart];
}

- (void)configerBackHandHitBallNum:(NSAttributedString *)hitBallNum StandardNum:(NSAttributedString *)StandardNum passRate:(NSAttributedString *)passRate sPXTexts:(NSDictionary *)sPXTexts averageSpeed:(NSString *)avg dotItems:(NSArray *)dotItems targetSpeed:(CGFloat )targetSpeed {
    
    self.backTotalHitBallNumberLabel.attributedText = hitBallNum;
    self.backStandardNumerLabel.attributedText = StandardNum;
    self.backPassRateLabel.attributedText = passRate;
    
    self.backShangxuanLabel.text = sPXTexts[@"ShangXuan"];
    self.backPingjiLabel.text = sPXTexts[@"PingJi"];
    self.backXueqiuLabel.text = sPXTexts[@"XueQiu"];
    self.backAverageSpeedLabel.text = avg;
    self.backScatterView.dotItems = dotItems;

    
    self.backTargetSpeed = targetSpeed;
    
    [self.backScatterView updateTargetSpeed:targetSpeed withTextString:@"目标拍速"];
    
    [self.backScatterView updateScatterDotLayer];
    [self.backScatterView drawChart];
    
}



@end
